package com.cadre.web.controller.officer;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cadre.common.utils.R;
import com.cadre.common.utils.annotation.SysLog;
import com.cadre.system.domain.officer.WarningIndex;
import com.cadre.system.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = {"预警设置接口"})
@RequestMapping({"/profess/warning"})
@RestController
public class WarningIndexController {
    @Resource
    private WarningIndexService warningIndexService;

    @PostMapping({"/update"})
    @ApiOperation("修改预警指标信息")
    public R updateWarningInfos(@RequestBody List<WarningIndex> warningIndex){
        warningIndexService.updateBatchById(warningIndex);
        return R.ok();
    }

    @GetMapping({"/getInfos"})
    @ApiOperation("获取预警指标")
    public R getWarningInfosByType(){
        LambdaQueryWrapper<WarningIndex> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        List<WarningIndex> list = warningIndexService.list(lambdaQueryWrapper);
        return R.ok().put("data",list);
    }


}
